package cn.dotalk.usermanage.controller;


import cn.dotalk.usermanage.config.DatasourceConfig;
import cn.dotalk.usermanage.utils.ResultMsg;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@RestController
@Slf4j
@RequestMapping("/config")
public class GetConfigController {

    @Resource
    private DatasourceConfig datasourceConfig;

    @RequestMapping("mysql-config")
    /**
     * http://localhost:8989/config/mysql-config
     */
    public Object index() {
        Map<String, Object> map = new HashMap<>();
        map.put("username", datasourceConfig.getUsername());
        return ResultMsg.success(map);
    }
}
